home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / aeroboto.c < prev    next >
C/C++ Source or Header  |  2000-04-23  |  11KB  |  328 lines

  1. /****************************************************************************
  2.  
  3. Formation Z / Aeroboto
  4.  
  5. Driver by Carlos A. Lozano
  6.  
  7. ****************************************************************************/
  8.  
  9. #include "driver.h"
  10. #include "vidhrdw/generic.h"
  11.  
  12.  
  13. extern unsigned char *aeroboto_videoram;
  14. extern unsigned char *aeroboto_fgscroll,*aeroboto_bgscroll;
  15. extern int aeroboto_charbank;
  16.  
  17. void aeroboto_gfxctrl_w(int ofset,int data);
  18. void aeroboto_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  19.  
  20.  
  21.  
  22. static int player;
  23.  
  24. static READ_HANDLER( aeroboto_in0_r )
  25. {
  26.     return readinputport(player);
  27. }
  28.  
  29. static READ_HANDLER( aeroboto_201_r )
  30. {
  31.     /* if you keep a button pressed during boot, the game will expect this */
  32.     /* serie of values to be returned from 3004, and display "PASS 201" if it is */
  33.     int res[4] = { 0xff,0x9f,0x1b,0x03};
  34.     static int count;
  35.     logerror("PC %04x: read 3004\n",cpu_get_pc());
  36.     return res[(count++)&3];
  37. }
  38.  
  39. static WRITE_HANDLER( aeroboto_3000_w )
  40. {
  41.     /* bit 0 selects player1/player2 controls */
  42.     player = data & 1;
  43.  
  44.     /* not sure about this, could be bit 2 */
  45.     aeroboto_charbank = (data & 0x02) >> 1;
  46.  
  47.     /* there's probably a flip screen here as well */
  48. }
  49.  
  50. static struct MemoryReadAddress readmem[] =
  51. {
  52.     { 0x0000, 0x07ff, MRA_RAM },
  53.     { 0x0800, 0x08ff, MRA_RAM },    /* ? copied to 2000 */
  54.     { 0x1000, 0x17ff, MRA_RAM },
  55.     { 0x1800, 0x183f, MRA_RAM },
  56.     { 0x2800, 0x28ff, MRA_RAM },
  57.     { 0x3000, 0x3000, aeroboto_in0_r },
  58.     { 0x3001, 0x3001, input_port_2_r },
  59.     { 0x3002, 0x3002, input_port_3_r },
  60.     { 0x3004, 0x3004, aeroboto_201_r },
  61.     { 0x3800, 0x3800, watchdog_reset_r },    /* or IRQ acknowledge */
  62.     { 0x4000, 0xffff, MRA_ROM },
  63.     { -1 }  /* end of table */
  64. };
  65.  
  66. static struct MemoryWriteAddress writemem[] =
  67. {
  68.     { 0x0000, 0x07ff, MWA_RAM },
  69.     { 0x0800, 0x08ff, MWA_RAM },    /* ? initialized on startup */
  70.     { 0x0900, 0x09ff, MWA_RAM },    /* ? initialized on startup (same as 0800) */
  71.     { 0x1000, 0x13ff, MWA_RAM, &aeroboto_videoram },
  72.     { 0x1400, 0x17ff, videoram_w, &videoram, &videoram_size },
  73.     { 0x1800, 0x181f, MWA_RAM, &aeroboto_fgscroll },
  74.     { 0x1820, 0x183f, MWA_RAM, &aeroboto_bgscroll },
  75.     { 0x2000, 0x20ff, MWA_RAM },    /* scroll? maybe stars? copied from 0800 */
  76.     { 0x2800, 0x28ff, MWA_RAM, &spriteram, &spriteram_size },
  77.     { 0x3000, 0x3000, aeroboto_3000_w },
  78.     { 0x3001, 0x3001, soundlatch_w },    /* ? */
  79.     { 0x3002, 0x3002, soundlatch2_w },    /* ? */
  80.     { 0x4000, 0xffff, MWA_ROM },
  81.     { -1 }  /* end of table */
  82. };
  83.  
  84. static struct MemoryReadAddress readmem_sound[] =
  85. {
  86.     { 0x0000, 0x0fff, MRA_RAM },
  87.     { 0x9002, 0x9002, AY8910_read_port_0_r },
  88.     { 0xa002, 0xa002, AY8910_read_port_1_r },
  89.     { 0xf000, 0xffff, MRA_ROM },
  90.     { -1 }  /* end of table */
  91. };
  92.  
  93. static struct MemoryWriteAddress writemem_sound[] =
  94. {
  95.     { 0x0000, 0x0fff, MWA_RAM },
  96.     { 0x9000, 0x9000, AY8910_control_port_0_w },
  97.     { 0x9001, 0x9001, AY8910_write_port_0_w },
  98.     { 0xa000, 0xa000, AY8910_control_port_1_w },
  99.     { 0xa001, 0xa001, AY8910_write_port_1_w },
  100.     { 0xf000, 0xffff, MWA_ROM },
  101.     { -1 }  /* end of table */
  102. };
  103.  
  104.  
  105.  
  106. INPUT_PORTS_START( formatz )
  107.     PORT_START    /* IN0 */
  108.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
  109.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )
  110.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  111.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
  112.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  113.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
  114.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
  115.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
  116.  
  117.     PORT_START    /* IN1 */
  118.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )
  119.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )
  120.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  121.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
  122.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  123.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
  124.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  125.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  126.  
  127.     PORT_START
  128.     PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) )
  129.     PORT_DIPSETTING(    0x00, "3" )
  130.     PORT_DIPSETTING(    0x01, "4" )
  131.     PORT_DIPSETTING(    0x02, "5" )
  132.     PORT_BITX( 0,       0x03, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "Infinite", IP_KEY_NONE, IP_JOY_NONE )
  133.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )
  134.     PORT_DIPSETTING(    0x0c, "30000" )
  135.     PORT_DIPSETTING(    0x08, "40000" )
  136.     PORT_DIPSETTING(    0x04, "70000" )
  137.     PORT_DIPSETTING(    0x00, "100000" )
  138.     PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
  139.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  140.     PORT_DIPSETTING(    0x10, DEF_STR( On ) )
  141.     PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) )
  142.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  143.     PORT_DIPSETTING(    0x20, DEF_STR( On ) )
  144.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Cabinet ) )
  145.     PORT_DIPSETTING(    0x40, DEF_STR( Upright ) )
  146.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  147.     /* the coin input must stay low for exactly 2 frames to be consistently recognized. */
  148.     PORT_BIT_IMPULSE( 0x80, IP_ACTIVE_LOW, IPT_COIN1, 2 )
  149.  
  150.     PORT_START
  151.     PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )
  152.     PORT_DIPSETTING(    0x07, DEF_STR( 5C_1C ) )
  153.     PORT_DIPSETTING(    0x05, DEF_STR( 4C_1C ) )
  154.     PORT_DIPSETTING(    0x03, DEF_STR( 3C_1C ) )
  155.     PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
  156.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  157.     PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
  158.     PORT_DIPSETTING(    0x04, DEF_STR( 1C_3C ) )
  159.     PORT_DIPSETTING(    0x06, DEF_STR( 1C_4C ) )
  160.     PORT_DIPNAME( 0x18, 0x00, DEF_STR( Difficulty ) )
  161.     PORT_DIPSETTING(    0x00, "Easy" )
  162.     PORT_DIPSETTING(    0x08, "Medium" )
  163.     PORT_DIPSETTING(    0x10, "Hard" )
  164.     PORT_DIPSETTING(    0x18, "Hardest" )
  165.     PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
  166.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  167.     PORT_DIPSETTING(    0x20, DEF_STR( On ) )
  168.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
  169.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  170.     PORT_DIPSETTING(    0x40, DEF_STR( On ) )
  171.     /* the manual lists the flip screen in the previous bank (replacing Coin A) */
  172.     PORT_DIPNAME( 0x80, 0x00, "Flip Screen?" )
  173.     PORT_DIPSETTING(    0x00, "Off?" )
  174.     PORT_DIPSETTING(    0x80, "On?" )
  175. INPUT_PORTS_END
  176.  
  177.  
  178.  
  179. static struct GfxLayout charlayout =
  180. {
  181.     8,8,    /* 8*8 chars */
  182.     512,    /* 512 characters */
  183.     2,    /* 2 bits per pixel */
  184.     { 4, 0 },
  185.     { 0, 1, 2, 3, 512*8*8+0, 512*8*8+1, 512*8*8+2, 512*8*8+3 },
  186.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  187.     8*8    /* every char takes 8 consecutive bytes */
  188. };
  189.  
  190. static struct GfxLayout spritelayout =
  191. {
  192.     8,16,    /* 8*16 sprites */
  193.     256,    /* 128 sprites */
  194.     3,    /* 3 bits per pixel */
  195.     { 2*256*16*8, 256*16*8, 0 },    /* the bitplanes are separated */
  196.     { 0, 1, 2, 3, 4, 5, 6, 7 },
  197.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  198.             8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
  199.     16*8    /* every sprite takes 16 consecutive bytes */
  200. };
  201.  
  202. static struct GfxDecodeInfo gfxdecodeinfo[] =
  203. {
  204.     { REGION_GFX1, 0, &charlayout,     0, 64 },    /* chars */
  205.     { REGION_GFX2, 0, &charlayout,     0, 64 },    /* sky */
  206.     { REGION_GFX3, 0, &spritelayout,   0, 32 },
  207.     { -1 } /* end of array */
  208. };
  209.  
  210.  
  211.  
  212. static struct AY8910interface ay8910_interface =
  213. {
  214.     2,      /* 2 chips */
  215.     1500000,        /* 1.5 MHz ? (hand tuned) */
  216.     { 25, 25 },
  217.     { soundlatch_r, 0 },    /* ? */
  218.     { soundlatch2_r, 0 },    /* ? */
  219.     { 0, 0 },
  220.     { 0, 0 }
  221. };
  222.  
  223. static struct MachineDriver machine_driver_formatz =
  224. {
  225.     /* basic machine hardware */
  226.     {
  227.         {
  228.             CPU_M6809,
  229.             1250000,        /* 1.25 Mhz ? */
  230.             readmem,writemem,0,0,
  231.             interrupt,1
  232.         },
  233.         {
  234.             CPU_M6809 | CPU_AUDIO_CPU,
  235.             1250000,        /* 1.25 Mhz ? */
  236.             readmem_sound,writemem_sound,0,0,
  237.             interrupt,1
  238.         }
  239.     },
  240.     60, DEFAULT_REAL_60HZ_VBLANK_DURATION,
  241.     1,    /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
  242.     0,    /* init machine */
  243.  
  244.     /* video hardware */
  245.     32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
  246.     gfxdecodeinfo,
  247.     256,256,
  248.     0,
  249.  
  250.     VIDEO_TYPE_RASTER,
  251.     0,
  252.     generic_vh_start,
  253.     generic_vh_stop,
  254.     aeroboto_vh_screenrefresh,
  255.  
  256.     /* sound hardware */
  257.     0,0,0,0,
  258.     {
  259.         {
  260.             SOUND_AY8910,
  261.             &ay8910_interface
  262.         }
  263.     }
  264. };
  265.  
  266. /***************************************************************************
  267.  
  268.   Game driver(s)
  269.  
  270. ***************************************************************************/
  271.  
  272. ROM_START( formatz )
  273.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for main CPU */
  274.     ROM_LOAD( "format_z.8",   0x4000, 0x4000, 0x81a2416c )
  275.     ROM_LOAD( "format_z.7",   0x8000, 0x4000, 0x986e6052 )
  276.     ROM_LOAD( "format_z.6",   0xc000, 0x4000, 0xbaa0d745 )
  277.  
  278.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for sound CPU */
  279.     ROM_LOAD( "format_z.9",   0xf000, 0x1000, 0x6b9215ad )
  280.  
  281.     ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  282.     ROM_LOAD( "format_z.5",   0x0000, 0x2000, 0xba50be57 )    /* characters */
  283.  
  284.     ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  285.     ROM_LOAD( "format_z.4",   0x0000, 0x2000, 0x910375a0 )    /* characters */
  286.  
  287.     ROM_REGION( 0x3000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  288.     ROM_LOAD( "format_z.1",   0x0000, 0x1000, 0x5739afd2 )    /* sprites */
  289.     ROM_LOAD( "format_z.2",   0x1000, 0x1000, 0x3a821391 )    /* sprites */
  290.     ROM_LOAD( "format_z.3",   0x2000, 0x1000, 0x7d1aec79 )    /* sprites */
  291.  
  292.     ROM_REGION( 0x0300, REGION_PROMS )
  293.     ROM_LOAD( "10a",          0x0000, 0x0100, 0x00000000 )
  294.     ROM_LOAD( "10b",          0x0100, 0x0100, 0x00000000 )
  295.     ROM_LOAD( "10c",          0x0200, 0x0100, 0x00000000 )
  296. ROM_END
  297.  
  298. ROM_START( aeroboto )
  299.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for main CPU */
  300.     ROM_LOAD( "aeroboto.8",   0x4000, 0x4000, 0x4d3fc049 )
  301.     ROM_LOAD( "aeroboto.7",   0x8000, 0x4000, 0x522f51c1 )
  302.     ROM_LOAD( "aeroboto.6",   0xc000, 0x4000, 0x1a295ffb )
  303.  
  304.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for sound CPU */
  305.     ROM_LOAD( "format_z.9",   0xf000, 0x1000, 0x6b9215ad )
  306.  
  307.     ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  308.     ROM_LOAD( "aeroboto.5",   0x0000, 0x2000, 0x32fc00f9 )    /* characters */
  309.  
  310.     ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  311.     ROM_LOAD( "format_z.4",   0x0000, 0x2000, 0x910375a0 )    /* characters */
  312.  
  313.     ROM_REGION( 0x3000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  314.     ROM_LOAD( "aeroboto.1",   0x0000, 0x1000, 0x7820eeaf )    /* sprites */
  315.     ROM_LOAD( "aeroboto.2",   0x1000, 0x1000, 0xc7f81a3c )    /* sprites */
  316.     ROM_LOAD( "aeroboto.3",   0x2000, 0x1000, 0x5203ad04 )    /* sprites */
  317.  
  318.     ROM_REGION( 0x0300, REGION_PROMS )
  319.     ROM_LOAD( "10a",          0x0000, 0x0100, 0x00000000 )
  320.     ROM_LOAD( "10b",          0x0100, 0x0100, 0x00000000 )
  321.     ROM_LOAD( "10c",          0x0200, 0x0100, 0x00000000 )
  322. ROM_END
  323.  
  324.  
  325.  
  326. GAMEX( 1984, formatz,  0,       formatz, formatz, 0, ROT0, "Jaleco", "Formation Z", GAME_NOT_WORKING | GAME_NO_COCKTAIL )
  327. GAMEX( 1984, aeroboto, formatz, formatz, formatz, 0, ROT0, "[Jaleco] (Williams license)", "Aeroboto", GAME_NOT_WORKING | GAME_NO_COCKTAIL )
  328.